/* ALGORITMO DE SHELL SORT (shellsort.c) */

#include "shellsort.h"

#define SEQUENCESIZE 8

void shellsort (char **words, int arraysize) {

	int i, j, k, gap = 0;
	int a[SEQUENCESIZE] = {701, 301, 132, 57, 23, 10, 4, 1};
	char *x = NULL;

	for(k=0; k < SEQUENCESIZE; k++) {
		gap = a[k];
		for(i=gap; i < arraysize; ++i) {
			x = words[i];
			for(j=i-gap; ((j >= 0) && (strcasecmp(words[j],x) > 0)); j=j-gap)
				words[j+gap] = words[j];
			words[j+gap] = x;
		}
	}
}

/* FIN DE ALGORITMO DE SHELL SORT (shellsort.c) */
